<?php $this->load->view('header');?>

<div class="page-container">
    <?php $this->load->view('sidebar');?>
    <!-- BEGIN CONTENT -->
    <div class="page-content-wrapper">
        <div class="page-content">
        <?php $this->load->view('teach/_sub_nav');?>
            <div class="row">
                <div class="col-md-12">
                    <?php $validationErrors = validation_errors();
                          if ($validationErrors) :?>
                        <div class="alert alert-warning fade in">
                            <a class="close" data-dismiss="alert">&times;</a>
                            <?php echo $validationErrors; ?>
                        </div>
                    <?php endif; ?>

                    <div class="admin-box">
                        <?php echo form_open($this->uri->uri_string(), array('class'=>'form-horizontal','role'=>'form')); ?>
                        <div class="form-body">
                            <h3 class="form-section"><?php echo lang('teacher_basic_info'); ?></h3>

                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('teacher_name') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('teacher_name'); ?><span class="required">*</span></label>
                                        <div class="col-md-6">
                                            <input type="text" name="teacher_name" id="teacher_name" class="form-control" value="<?php echo set_value('teacher_name', isset($teacher) ? $teacher->teacher_name : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('teacher_name'); ?></span>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('teacher_nickname') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('teacher_nickname'); ?></label>
                                        <div class="col-md-6">
                                            <input type="text" name="teacher_nickname" id="teacher_nickname" class="form-control" value="<?php echo set_value('teacher_nickname', isset($teacher) ? $teacher->teacher_nickname : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('teacher_nickname'); ?></span>
                                        </div>
                                    </div>
                                </div>
                            </div>

                             <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('phone') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('teacher_phone'); ?><span class="required">*</span></label>
                                        <div class="col-md-4">
                                            <input type="text" name="phone" id="phone" class="form-control" value="<?php echo set_value('phone', isset($teacher) ? $teacher->phone : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('phone'); ?></span>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('tel') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('teacher_tel'); ?></label>
                                        <div class="col-md-4">
                                            <input type="text" name="tel" id="tel" class="form-control" value="<?php echo set_value('tel', isset($teacher) ? $teacher->tel : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('tel'); ?></span>
                                        </div>
                                    </div>
                                </div>
                            </div>


                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('sex') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('teacher_sex'); ?></label>
                                        <div class="col-md-9">
                                            <div class="radio-list">
                                                <label class="radio-inline">
                                                <div class="radio"><span><input type="radio" name="sex" value="0"></span></div>
                                                <?php echo lang('teacher_sex_male'); ?> </label>
                                                <label class="radio-inline">
                                                <div class="radio"><span class="checked"><input type="radio" name="sex" value="1" checked=""></span></div>
                                                <?php echo lang('teacher_sex_female'); ?> </label>
                                            </div>
                                            <span class="help-block"><?php echo form_error('sex'); ?></span>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('address') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('teacher_address'); ?></label>
                                        <div class="col-md-9">
                                            <input type="text" name="address" id="address" class="form-control" value="<?php echo set_value('address', isset($teacher) ? $teacher->address : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('address'); ?></span>
                                        </div>
                                    </div>
                                </div>
                            </div>

                             <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('idcard') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('teacher_idcard'); ?></label>
                                        <div class="col-md-9">
                                            <input type="text" name="idcard" id="idcard" class="form-control" value="<?php echo set_value('idcard', isset($teacher) ? $teacher->idcard : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('idcard'); ?></span>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('birthday') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('teacher_birthday'); ?></label>
                                        <div class="col-md-5">
                                            <div class="input-group date date-picker">
                                                <input type="text" name="birthday" id="birthday" class="form-control" value="<?php echo set_value('birthday', isset($teacher) ? $teacher->birthday : ''); ?>" />
                                                <span class="input-group-btn">
                                                    <button class="btn default" type="button"><i class="fa fa-calendar"></i></button>
                                                </span>
                                            </div>
                                            <span class="help-block"><?php echo form_error('birthday'); ?></span>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('email') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('email'); ?></label>
                                        <div class="col-md-9">
                                            <input type="text" name="email" id="email" class="form-control" value="<?php echo set_value('email', isset($clue) ? $clue->email : ''); ?>" />
                                            <span class="help-block"><?php echo form_error('email'); ?></span>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('entry_date') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('teacher_entry_date'); ?></label>
                                        <div class="col-md-5">
                                            <div class="input-group date date-picker">
                                                <input type="text" name="birthday" id="birthday" class="form-control" value="<?php echo set_value('birthday', isset($teacher) ? $teacher->entry_date : ''); ?>" />
                                                <span class="input-group-btn">
                                                    <button class="btn default" type="button"><i class="fa fa-calendar"></i></button>
                                                </span>
                                            </div>
                                            <span class="help-block"><?php echo form_error('entry_date'); ?></span>
                                        </div>
                                    </div>
                                </div>

                            </div>

                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('type') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><font color="red">*</font><?php echo lang('teacher_type'); ?></label>
                                        <div class="col-md-4">
                                            <select name="type" id="type" class="form-control" >
                                                <?php foreach($this->config->item('comm.teacher_type') as $key=>$value):?>
                                                    <option value="<?php echo $key;?>" <?php echo set_select('type', $key); ?>><?php echo $value;?></option>
                                                <?php endforeach;?>
                                            </select>
                                            <span class="help-block"><?php echo form_error('type'); ?></span>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('level') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('teacher_level'); ?></label>
                                        <div class="col-md-4">
                                            <select name="level" id="level" class="form-control" >
                                                <?php foreach($this->config->item('comm.teacher_level') as $key=>$value):?>
                                                    <option value="<?php echo $key;?>" <?php echo set_select('level', $key); ?>><?php echo $value;?></option>
                                                <?php endforeach;?>
                                            </select>
                                            <span class="help-block"><?php echo form_error('level'); ?></span>
                                        </div>
                                    </div>
                                </div>
                            </div>



                            <div class="row">
                                 <div class="col-md-6">
                                    <div class="form-group">
                                        <label class="control-label col-md-3"><?php echo lang('teacher_info'); ?></label>
                                        <div class="col-md-9">
                                            <textarea name="info" class="form-control"></textarea>
                                            <span class="help-block"></span>
                                        </div>
                                    </div>
                                 </div>

                            </div>

                            <h3 class="form-section"><?php echo lang('teacher_system_info'); ?></h3>

                             <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group<?php echo form_error('consultant') ? ' has-error' : ''; ?>">
                                        <label class="control-label col-md-3" ><?php echo lang('teacher_consultant'); ?></label>
                                        <div class="col-md-9">
                                            <select name="consultant" id="consultant" class="form-control" >
                                                    <?php if (isset($consultants) && is_array($consultants) && count($consultants)) :?>
                                                        <?php foreach ($consultants as $consultant) :?>
                                                             <option value="<?php echo $consultant->id; ?>" <?php echo set_select('consultant', $consultant->id, $current_user->id); ?>>
                                                                <?php e(ucfirst($consultant->display_name)); ?>
                                                            </option>
                                                        <?php endforeach; ?>
                                                    <?php else:?>
                                                        <option value="0">无</option>
                                                    <?php endif;?>
                                            </select>
                                            <span class="help-block"><?php echo form_error('consultant'); ?></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="form-actions fluid">
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="col-md-offset-3 col-md-9">
                                        <button type="submit" class="btn green" name="save"><?php echo lang('action_save');?></button>
                                        <a href="<?php echo site_url('/teach/teachers');?>" class="btn default"><?php echo lang('action_cancel');?></a>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                </div>
                            </div>
                        </div>
                        <?php echo form_close(); ?>
                    </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>



        <?php $this->load->view('footer');?>

        <script type="text/javascript" src="assets/scripts/custom/clue.js"></script>

        <script>
            jQuery(document).ready(function() {
                App.init(); // initlayout and core plugins
                Clue.init();
            });
        </script>

        </body>
        <!-- END BODY -->
        </html>